<html>
<head>
    <script src="js/jquery.js"></script>
    <link href="css/css.css" rel="stylesheet" type="text/css">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="format-detection" content="telephone=no" />
    <meta charset="utf-8">
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <title>添加地址</title>
    <style>
        /*地址输入框*/
        .column_box input{ line-height:46px; color:#191919; font-size:14px; float:left; margin-left:12px;}
    </style>
</head>

<body style="background-color: #f9f9f9;">
<!--header顶部标题-->
<div class="header">修改服务地址
    <div class="header_left" onclick="window.history.go(-1)"><img src="images/return.png"></div>
</div>
<!--column搜索小区-->
<div class="column_box" onclick="document.location='address_sear';">
    <div class="border_top"></div>
    <div class="column_img"><img src="images/adrress.png"></div>
    <?php if(session('title')!=""){?>
    <span id="say_id">{{ Session::get('title')}}</span>
    <?php }else{?>
    <span id="say_id">{{$row->say_id}}</span>
    <?php }?>
    <div class="next"><img src="images/arrow.png"></div>
    <div class="border_bottom"></div>
</div>
<form action="address_site" method="post">
@csrf
<!--column详细地址-->
    <div class="column_box">
        <div class="column_img"><img src="images/adrress_2.png"></div>
        <input placeholder="详细地址，如xx号楼xx单元xx室" id="dz" value="{{$row->dz}}"></input>
        <div class="border_bottom"></div>
    </div>
    <!--column联系人-->
    <div class="column_box">
        <div class="column_img"><img src="images/people.png"></div>
        <input placeholder="联系人" id="addname" value="{{$row->addname}}"></input>
        <div class="border_bottom"></div>
    </div>
    <!--column电话-->
    <div class="column_box">
        <div class="column_img"><img src="images/phone.png"></div>
        <input placeholder="联系电话" type="number" id="tel" value="{{$row->tel}}"></input>
        <div class="border_bottom"></div>
    </div>
    <!--confirm确认添加-->
    <input type="hidden" id="id" value="{{$row->id}}"></input>
    <div class="confirm"><input type="button" id="submit" value="确认修改"></div>
</form>
<script>
    $.ajaxSetup({
        headers: {
            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        }
    });

    $('#submit').click(function() {
        var say_id = $('#say_id').text();
        var id = $('#id').val();
        var dz = $('#dz').val();
        var addname = $('#addname').val();
        var tel = $('#tel').val();
        $.ajax({
            type:"post",
            url: "address_alter",
            data: {
                'id':id,
                'addname':addname,
                'tel':tel,
                'dz':dz,
                'say_id':say_id,
            },
            success:function(data){
                if(data==1){
                    document.location='address';
                    exit();
                }
            }
        });
        return false;
    });
    var i=0;
    var x=0;
    $(".area_box").click(function(){//点击下拉列表

        if(i==0){$(".area_box").animate({height:'187px'});i=1}else{$(".area_box").animate({height:'32px'}); i=0}//显示隐藏选项
    })
    $(".box").click(function(){//点击选项：切换背景颜色
        $(this).css("background-color","#CCCCCC").siblings().css("background-color","#fff");
        $(".chenge").html($(this).html());//点击选项：替换文本
    })
</script>
</body>
</html>
